package com.punch.common.enums.order;

/**
 * @author xiaol
 * @date 2020/7/21 15:53
 * 订单取消状态
 */

public enum CancelStatusEnum {

    NONE(0, "无取消"),

    UN_PAY_TIMEOUT_CANCEL(1, "未付款超时取消"),

    UN_PAY_USER_CANCEL(2, "未付款用户取消"),

    PAY_USER_CANCEL(3, "付款用户取消"),

    UN_OPEN_CLASS_CANCEL(4, "未成班取消");

    CancelStatusEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    private int code;
    private String name;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public static String getName(Integer code) {
        if (code == null) {
            return "";
        }
        for (CancelStatusEnum cancelStatusEnum : CancelStatusEnum.values()) {
            if (cancelStatusEnum.getCode() == code) {
                return cancelStatusEnum.getName();
            }
        }
        return "";
    }
}

